# @shuaige : 陈世玉
# @name :SpiderMain.py
# @time :2024/12/7 14:32
from selenium import webdriver
import time
from bs4 import BeautifulSoup
path=r'chromedriver.exe'
def common_browser():
    browser = webdriver.Chrome(path)
    return browser
def main():
    print('爬虫开始')
    browser = common_browser()
    url = 'https://www.zhipin.com/web/geek/job?city=100010000&industry=100020,100021&position=100101,100109,100123'
    browser.get(url)
    time.sleep(10)
    for i in range(1, 9):
        # time.sleep(10)
        job_names=browser.find_elements_by_xpath('//span[@class="job-name"]')
        job_areas=browser.find_elements_by_xpath('//span[@class="job-area"]')
        for i in range(0,len(job_names)):
            print(job_names[i].text,job_areas[i].text)
        next_buttom = browser.find_element_by_xpath('//div[@class="options-pages"]/a[10]')
        time.sleep(10)
        next_buttom.click()
        # time.sleep(10)
    browser.quit()

if __name__ == '__main__':
    main()

